/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TimeRecording.forms.renderers;

import TimeRecording.enums.PatternType;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

/**
 *
 * @author cbegg
 */
public class PeriodTypeListCellRenderer extends DefaultListCellRenderer {

private static final long serialVersionUID = 1L;
    @Override
    public Component getListCellRendererComponent(
            JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        if (value instanceof PatternType) {
            PatternType pt = (PatternType) value;
            setText(pt.name());
        }
        return this;
    }
}
